unit EditFormUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,SQLCreator, Grids, DBGrids, StdCtrls, Mask, DBCtrls, ExtCtrls;

type
  TEditForm = class(TForm)
    DBEdit1: TDBEdit;
    DBEdit2: TDBEdit;
    DBGrid1: TDBGrid;
    DBNavigator1: TDBNavigator;
    procedure FormShow(Sender: TObject);
  private
     strategy : ISQLCreator;
    { Private declarations }
  public
  procedure SetStrategy(Mystrategy: ISQLCreator);
    { Public declarations }
  end;

var
  EditForm: TEditForm;

implementation

uses Math, DataModuleUnit;

{$R *.dfm}
  procedure TEditForm.SetStrategy(Mystrategy: ISQLCreator);
  begin
  strategy := Mystrategy;
  end;
procedure TEditForm.FormShow(Sender: TObject);
begin
EditForm.Text :='EDITOR FIELD ['+strategy.GetTableName+']';
If(strategy.GetTableName = 'EnglishDictionary') then
  begin
    DBGrid1.DataSource := DataModule1.EnglishTableDataSource;
    DBEdit1.DataSource := DataModule1.EnglishTableDataSource;
    DBEdit1.DataField := 'Id';
    DBEdit2.DataSource := DataModule1.EnglishTableDataSource;
    DBEdit2.DataField := strategy.GetFieldName;
    DBNavigator1.DataSource := DataModule1.EnglishTableDataSource;

  end
  else
    begin
  DBGrid1.DataSource := DataModule1.RussiaTableDataSource;
    DBEdit1.DataSource := DataModule1.RussiaTableDataSource;
    DBEdit1.DataField := 'Id';
    DBEdit2.DataSource := DataModule1.RussiaTableDataSource;
    DBEdit2.DataField := strategy.GetFieldName;
     DBNavigator1.DataSource := DataModule1.RussiaTableDataSource;


  end;
end;

end.


